/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "county")
@NamedQueries({
    @NamedQuery(name = "County.findAll", query = "SELECT c FROM County c"),
    @NamedQuery(name = "County.findByIdcounty", query = "SELECT c FROM County c WHERE c.idcounty = :idcounty"),
    @NamedQuery(name = "County.findByCounty", query = "SELECT c FROM County c WHERE c.county = :county")})
public class County implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idcounty")
    private Integer idcounty;
    @Basic(optional = false)
    @Column(name = "county")
    private String county;
    @OneToMany(mappedBy = "county", fetch = FetchType.LAZY)
    private List<Localityelement> localityelementList;

    public County() {
    }

    public County(Integer idcounty) {
        this.idcounty = idcounty;
    }

    public County(Integer idcounty, String county) {
        this.idcounty = idcounty;
        this.county = county;
    }

    public Integer getIdcounty() {
        return idcounty;
    }

    public void setIdcounty(Integer idcounty) {
        this.idcounty = idcounty;
    }

    public String getCounty() {
        return county;
    }

    public void setCounty(String county) {
        this.county = county;
    }

    public List<Localityelement> getLocalityelementList() {
        return localityelementList;
    }

    public void setLocalityelementList(List<Localityelement> localityelementList) {
        this.localityelementList = localityelementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcounty != null ? idcounty.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof County)) {
            return false;
        }
        County other = (County) object;
        if ((this.idcounty == null && other.idcounty != null) || (this.idcounty != null && !this.idcounty.equals(other.idcounty))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.County[idcounty=" + idcounty + "]";
    }

}
